
import {
  WINDOW_WIDTH,
  WINDOW_HEIGHT
} from '../constants/varibles'

class Help {
  proportionX (sizeX) {
    return (sizeX / 750) * WINDOW_WIDTH
  }
  proportionY (sizeY) {
    return (sizeY / 1330) * WINDOW_HEIGHT
  }
  /**
 * 保留几位小数
 * @param  price 价格
 * @param  num 要保留几位小数
 * @return {[type]}       [description]
 */
  toFixed (price, num) {
    // let currPrice = new Number(price);
    const currPrice = parseFloat(price)
    const fixedNum = currPrice.toFixed(num)
    return fixedNum
  }
/**
 * 判断是否为空 (初级)
 * @param  {[type]}  content [description]
 * @return {Boolean}         [description]
 */
  noEmpty (content) {
    if (content !== undefined && content !== null) {
      return true
    }
    return false
  }
/**
 *
 * @param  {[type]}  array [description]
 * @return {Boolean}       [description]
 */
  isNo (array) {
    if (array !== undefined && array !== null && array.length > 0) {
      return false
    }
    return true
  }
  stringNoEmpty (content) {
    if (content !== undefined && content !== null && content !== 'null' && content !== '') {
      return true
    }
    return false
  }
  imisNo (array) {
    if (array !== undefined && array !== null && array.size > 0) {
      return false
    }
    return true
  }
}
const help = new Help()
export default help
